import java.util.Scanner;


public class FactorialCeros {

	public static void main(String[] args) {
		Scanner leer = new Scanner(System.in);
		int cant = leer.nextInt();
		for (int i=0;i<cant;i++){
			long   a = leer.nextLong();
			long fac=0;
			if(a==5)
				fac=1;
			if(a>5){
				for(long j =5;a/j>=1;j*=5){
					fac += a/j;
				}
			}
			System.out.println(fac);
		}

	}

}
